package com.tianqu.tms.core.mail;

import java.util.HashMap;
import java.util.Map;

/**
 * mailhelper 的manager
 * @author liugang
 *
 */
public class MailHelperManager {
	
	private static MailHelperManager instance;
	
	private String appName;
	private String appUrl;
	private Map childrenMap = new HashMap();
	
	/**
	 * 
	 * @param templatePath
	 * @throws Exception
	 */
	public static void init(String templatePath) throws Exception{
		MailHelperDigester digester = new MailHelperDigester();
		instance = digester.digest(templatePath);
	}
	
	public static MailHelperManager getInstance(){
		return instance;
	}
	
	public String getAppName() {
		return appName;
	}
	public void setAppName(String appName) {
		this.appName = appName;
	}
	public String getAppUrl() {
		return appUrl;
	}
	public void setAppUrl(String appUrl) {
		this.appUrl = appUrl;
	}

	public void add(MailHelper mailHelper) {
		childrenMap.put(mailHelper.getId(),mailHelper);
	}
	
	public MailHelper getHelper(String funcId){
		return (MailHelper)childrenMap.get(funcId);
	}
	
	public Map getChildrenMap(){
		return childrenMap;
	}
}
